<!DOCTYPE stack PUBLIC "-//Apple, Inc.//DTD stack V 2.0//EN" "" >
<stack>
<name>in.26e updater</name>
<id>-1</id>
<cardCount>1</cardCount>
<cardID>2823</cardID>
<listID>3717</listID>
<cantModify><false /></cantModify>
<cantDelete><false /></cantDelete>
<cantAbort><false /></cantAbort>
<cardSize>
<width>320</width>
<height>272</height>
</cardSize>
<script>function getHandler handlerName,scriptText,returnOffsets-- script 2-11: Extract a handler from a script.-- Given the name of a handler and a script, this handler gets-- the text of the specified handler. Optionally, it will-- return starting and ending character expressions of the handler.-- check for function first because on is a substring of functionget offset("function " & handlerName,scriptText)if it is zero then get offset("on " & handlerName,scriptText)put it into startCharput return & "end " & handlerName into footerput offset(footer,scriptText) into endCharif endChar is not zero thenadd length(footer) to endCharrepeat until char endChar of scriptText is return ¬or char endChar of scriptText is empty -- skip commentadd 1 to endCharend repeatrepeat while char endChar + 1 of scriptText is returnadd 1 to endChar -- take trailing returnsend repeatend ifif returnOffsets is truethen return startChar & "," & endCharelse return char startChar to endChar of scriptTextend getHandlerfunction putHandler newHandler,scriptText-- script 2-12: Place a handler into a script.-- Given the name of a handler and a script, this handler puts-- the text of the specified handler into the specified script,-- replacing the previous version of the handler in that script.put word 2 of newHandler into handlerNameput getHandler(handlerName,scriptText,true) into offsetsput item 1 of offsets into startCharput item 2 of offsets into endCharput newHandler & return into char startChar to endChar of scriptTextreturn scriptTextend putHandler</script>